package com.vlong.town.service.townInfo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.vlong.town.entity.townInfo.TownInfo;
import com.vlong.town.mapper.townInfo.TownInfoMapper;

/**
 * 村镇信息业务实现类
 * @author Assassin
 */
@Service
public class TownInfoService {

    // Fields

    @Autowired
    private TownInfoMapper townInfoMapper;// 村镇信息Mapper接口

    // Methods

    /**
     * 根据村镇Id查询村镇信息
     * @param townId 村镇Id
     * @return TownInfo
     */
    public TownInfo query(Long townId) {
        return this.townInfoMapper.select(townId);
    }

    /**
     * 保存村镇信息
     * @param townInfo 参数实体
     */
    @Transactional
    public void update(TownInfo townInfo) {
        townInfo.setUpdateTime(System.currentTimeMillis());
        this.townInfoMapper.update(townInfo);
    }

}
